using System;
using System.Collections.Generic;
using OWL.Rendering.HRP;
using UnityEngine;

namespace Yoozoo.Gameplay.City
{

    [Serializable]
    public class AreaBlurParameters
    {
        [Header("模糊半径(按像素计算)")]
        [Range(0, 10.0f)]
        public float blurRadius = 1.0f;

        [Header("清晰画面中心")]
        public Vector2 center = new Vector2(0.5f,0.5f);

        [Header("旋转角度(以清晰画面中心为原点，逆时针方向)")]
        public float angle = 0.0f;

        [Header("清晰区域宽高（占画面比例）,该区域内完全清晰")]
        //[Range(0, 0.5f)]
        public Vector2 rangeClear = new Vector2(0.4f,0.4f);

        [Header("模糊区域宽高（占画面比例），该区域外完全模糊")]
        //[Range(0, 0.5f)]
        public Vector2 rangeBlur = new Vector2(0.5f,0.5f);

        [Header("标记颜色")]
        public Color color = Color.white;
    }
    
    [RequireComponent(typeof(HAreaBlurComponent))]
    public class AreaBlurSettings : MonoBehaviour
    {
        public HAreaBlurComponent blurComponent;
        public List<AreaBlurParameters> paramList;

        public void SetAreaBlurParam(int index)
        {
            if (index < 0 || index >= paramList.Count)
            {
                return;
            }

            AreaBlurParameters parameters = paramList[index];
            
            blurComponent.data.blurRadius = parameters.blurRadius;
            blurComponent.data.center = parameters.center;
            blurComponent.data.rangeClear = parameters.rangeClear;
            blurComponent.data.rangeBlur = parameters.rangeBlur;
            blurComponent.data.color = parameters.color;
            blurComponent.data.angle = parameters.angle;

        }
        
    }
}